/* Frame paving */
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;
int x, y, n, a;
int p[5];
bool found;

void inp()
{
  cin >> x >> y >> n;
}

bool check(int k)
{
  if ((k == 1) || (k == 3))
  {
    if (p[k-1] != p[k]) return ((x-1)%a == 0);
    if (p[k] == 0) return (x%a == 0);
    return ((x-2)%a == 0);
  }
  else
  {  
    if (p[k-1] != p[k]) return ((y-1)%a == 0);
    if (p[k] == 1) return (y%a == 0);
    return ((y-2)%a == 0);
  }   
}
     
void attempt(int k)
{
  if (found) return;
  if (k == 5) 
  {
    found = true;
    return;
  }
  if (k == 4) 
  {
    p[4] = p[0];
    if (check(k)) attempt(k+1);
  }
  else
  {   
    p[k] = 0;  
    if ((k == 0) || ((k > 0) && (check(k)))) attempt(k+1);
    p[k] = 1;
    if ((k == 0) || ((k > 0) && (check(k)))) attempt(k+1);
  }
}

void process()
{
  for (int i = 0; i < n; i++)
  {
    cin >> a;
    found = false;
    attempt(0);
    if (found) cout << "YES" << endl;
    else cout << "NO" << endl;    
  }      
}
 
main()
{
//  freopen("#044.in", "r", stdin);
//  freopen("#044.out", "w", stdout); 
  
  inp();
  process();
  return 0;
}
